﻿
@{
    ViewBag.Title = "搜索结果";
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.PageNum = 2;
    var type = Model.ResultInfo.DocType;
    var fist = type.Where(it => it.Level == 1).ToList();
}
@using Infrastructure.ViewModels
@using Infrastructure.Pub;
@using SyntacticSugar
@section css{
    <link href="~/_theme/ueditor/utf8-net/third-party/SyntaxHighlighter/shCoreDefault.css" rel="stylesheet" />
    <link href="~/_theme/css/page/doc.css" rel="stylesheet" />
    <link href="~/_theme/css/fonts/fonts.css" rel="stylesheet" />
    <style>
        .search-list {
            padding: 10px;
            padding-left:0
        }
        .search-box {
            padding-top: 10px;
        }
            .search-list a {
                color: #2440b3;
                font-size: 18px;
                line-height: 22px;
            }

        .site-content red {
            font-size: 14px;
            color: #999;
        }
    </style>
}
@section js{
    <script src="~/_theme/ueditor/utf8-net/third-party/SyntaxHighlighter/shCore.js"></script>
    <script type="text/javascript">SyntaxHighlighter.all();</script>
}
@model ResultModel<DocDetailsResult>
<div class="layui-main site-inline">
    <div class="site-tree">
        <ul class="layui-tree">
            <li>
                <form id="frmSearch" action="/home/DocSearch?masterId=@Model.ResultInfo.MasterId&typeId=@Model.ResultInfo.TypeId" class="fly-search" method="get">
                    <i onclick="frmSearch.submit()" class="iconfont icon-sousuo"></i>
                    <input type="hidden" name="masterId" value="@Model.ResultInfo.MasterId">
                    <input class="layui-input" autocomplete="off" value="" placeholder="搜索内容，回车跳转" type="text" name="title">
                </form>
            </li>
            @if (type.IsValuable() && fist.IsValuable())
            {

                foreach (var item in fist)
                {
                    var itemChildren = type.Where(it => item.Id == it.ParentId).ToList();
                    <li class="clear"><h2>@item.TypeName</h2></li>
                    foreach (var childItem in itemChildren)
                    {
                        <li class="@((type.Count>25&&fist.Count>1?"site-float":"")) site-tree-noicon @((fist.IndexOf(item)==0&&itemChildren.IndexOf(childItem)==0).IIF("layui-this",""))">
                            <a href="@Url.Action("Doc",new { typeId=childItem.Id})"><cite>@childItem.TypeName</cite></a>
                        </li>
                    }
                }
            }
        </ul>
    </div>
    <div class="site-content">

        <red>Sugar为您找到相关结果@(@Model.ResultInfo.SearchList.Count)个</red>
        <div class="search-box">
            @foreach (var item in Model.ResultInfo.SearchList)
            {
                <div class="search-list">
                    <a href="/home/doc?masterId=@Model.ResultInfo.MasterId&typeId=@item.Id">@(1 + Model.ResultInfo.SearchList.IndexOf(item))、 @item.TypeName</a>
                </div>
            }
        </div>
    </div>
</div>
<div class="site-tree-mobile layui-hide">
    <i class="layui-icon"></i>
</div>